 package net.weibo.ui; 
 
import android.app.Activity;
import android.util.Log;
import android.view.KeyEvent;
 

/**
 * @author Kadar.Li
 * @date 2011-7-5 下午02:09:05 
 * @Description: 
 * @version V1.0 
 */
public abstract class BaseActivity extends Activity{

	protected MainActivity mMainActivity;
	protected int mActivityName;
	
	public BaseActivity(){
	}
	
	/**
	 * 设置MainActivity的引�?
	 *
	 * @param instance
	 * @return 
	 */
	public void setMainActivity(MainActivity instance){
		this.mMainActivity = instance;
	}
	
	/**
	 * 进入页面，准�?
	 *
	 * @return 
	 */
	public abstract void onIntoScreen();
	
	/**
	 * 进入页面,结束
	 * 
	 * @return void
	 * @throws
	 */
	public abstract void onIntoScreenEnd();
	
	
	/**
	 * 离开页面,准备
	 *
	 * @return 
	 */
	public abstract void onLeaveScreen();
	
	/**
	 * 离开页面，结�?
	 * 
	 * @return void
	 * @throws
	 */
	public abstract void onLeaveScreenEnd();
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
	
		 Log.e("keydown", "-------(Base)onKeyDown");
		mMainActivity.onKeyDown(keyCode, event);
		 
		return true;
	}

	public int getActivityName() {
		return mActivityName;
	}

	public void setActivityName(int activityName) {
		this.mActivityName = activityName;
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		mMainActivity = null;
	}
}
